<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SWM34S_LVGL7.11_SWMUI: C:/Users/DELL/Desktop/Commit/lvgl/SWM34S_LVGL7.11_SWMUI_20230515/APP/Software_Parser/jfif_parser.c 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">SWM34S_LVGL7.11_SWMUI<span id="projectnumber">&#160;V7.9</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.5 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_0ca16891106f5a3e9ad635a0d6c5f98f.html">APP</a></li><li class="navelem"><a class="el" href="dir_1f0f7ecfcd3eb0933dd9ad093070e0ed.html">Software_Parser</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">jfif_parser.c</div></div>
</div><!--header-->
<div class="contents">
<a href="jfif__parser_8c.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#include &quot;<a class="code" href="jfif__parser_8h.html">jfif_parser.h</a>&quot;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span> </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="jfif__parser_8c.html#ad5869f8e3b141200c34cb4541329a8b2">   25</a></span>jfif_info_t <a class="code hl_variable" href="jfif__parser_8c.html#ad5869f8e3b141200c34cb4541329a8b2">JFIF_Info</a>;</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="jfif__parser_8c.html#abf9f65ef7651d67c735920acc808427a">   37</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="jfif__parser_8c.html#abf9f65ef7651d67c735920acc808427a">jfif_parse</a>(<span class="keyword">const</span> uint8_t buf[], uint32_t len, jfif_info_t *jfif_info)</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span>{</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span>    uint32_t index = 0;</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>    uint16_t marker = 0;</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    uint16_t blklen = 0;</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span>    uint32_t i = 0, j = 0;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span> </div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    <span class="comment">/* 必须清空上一次解析图片格式残留的信息 */</span></div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    memset(jfif_info, 0, <span class="keyword">sizeof</span>(jfif_info_t));</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>    <span class="keywordflow">do</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span>    {</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>        marker = buf[index++];</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span>        marker = (marker &lt;&lt; 8) | buf[index++];</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>        <span class="keywordflow">switch</span> (marker)</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>        {</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#abc075d5ba82599e6162dee5140312ebb">JFIF_MKR_SOI</a>: <span class="comment">/* 图像开始 */</span></div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span> </div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a172b132fe97aa2942518e04729cfcb86">JFIF_MKR_APP0</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a7f59810f48f8ef149eb486375f55c494">JFIF_MKR_APP1</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#abdc9b4d26d096c86838f459df7fcc346">JFIF_MKR_APP2</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a7aa18bbaba75cbce2043f7c491fc1ea3">JFIF_MKR_APP3</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a556cc4919d609155d762078774ce2f9d">JFIF_MKR_APP4</a>:</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a6fc9691d02dac880729c77500ca74840">JFIF_MKR_APP5</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a98cc24ac5256f960b8450aa4adca78b9">JFIF_MKR_APP6</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a98623911284c193c0118fee1ddb2f993">JFIF_MKR_APP7</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a1e00683a66e9cd95bdf96c5ce017642f">JFIF_MKR_APP8</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#ad062996de504f692a05352122cf7971c">JFIF_MKR_APP9</a>:</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a6861f9aab4c23e24e8a961aed25494c3">JFIF_MKR_APPa</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#aa9138cde6f4eec984591fa8c349ff00a">JFIF_MKR_APPb</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a6e341919d001f46a6596443f30aeffed">JFIF_MKR_APPc</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#ae88e60f25611f85e5e747b7bffd74663">JFIF_MKR_APPd</a>:<span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#ab902af7fd9759bbaa04a30b84d1e8712">JFIF_MKR_APPe</a>:</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#ae8610e4d1a9cd877e75be61940546d79">JFIF_MKR_APPf</a>:</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>            index += (buf[index] &lt;&lt; 8) | buf[index + 1];</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#aa3aca71aaed62e13cdd3a0a3b7fef752">JFIF_MKR_DQT</a>: <span class="comment">/* 量化表 */</span></div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span>            blklen = (buf[index] &lt;&lt; 8) | buf[index + 1];</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>            index += 2;</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>            blklen -= 2;</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span>            <span class="keywordflow">while</span> (blklen)</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>            {</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>                uint8_t idx = buf[index] &amp; 0x0F;</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>                uint8_t fmt = buf[index] &gt;&gt; 4; <span class="comment">/* table element precision, 0 8-bit   1 16-bit */</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span> </div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>                <span class="keywordflow">if</span> (fmt != 0)</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>                    <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#ac50c00bd04463311543693c1b79f40ee">JFIF_NO_SUPPORT</a>;</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>                <span class="keywordflow">if</span> (idx &gt;= JFIF_QTAB_MAX)</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span>                    <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#ac50c00bd04463311543693c1b79f40ee">JFIF_NO_SUPPORT</a>;</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>                <span class="keywordflow">for</span> (j = 0; j &lt; 64; j++)</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span>                    jfif_info-&gt;QTable[idx][j] = buf[index + 1 + j];</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>                jfif_info-&gt;QTableCnt++;</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span> </div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>                index += 65;</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>                blklen -= 65;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>            }</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span> </div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno">   89</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#adeb5763efbd0957a8bd88656961a27eb">JFIF_MKR_SOF0</a>: <span class="comment">/* 帧开始 */</span></div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno">   90</span>            <span class="keywordflow">if</span> (buf[index + 2] != 8)</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span>                <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#ac50c00bd04463311543693c1b79f40ee">JFIF_NO_SUPPORT</a>;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span> </div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span>            jfif_info-&gt;Height = (buf[index + 3] &lt;&lt; 8) | buf[index + 4];</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>            jfif_info-&gt;Width = (buf[index + 5] &lt;&lt; 8) | buf[index + 6];</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span> </div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>            jfif_info-&gt;CompCnt = buf[index + 7];</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span>            <span class="keywordflow">if</span> (jfif_info-&gt;CompCnt != 3)</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>                <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#ac50c00bd04463311543693c1b79f40ee">JFIF_NO_SUPPORT</a>;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span> </div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>            index += 8;</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>            <span class="keywordflow">for</span> (i = 0; i &lt; jfif_info-&gt;CompCnt; i++)</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span>            {</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span>                jfif_info-&gt;CompInfo[i].id = buf[index];</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>                jfif_info-&gt;CompInfo[i].hfactor = buf[index + 1] &gt;&gt; 4;</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno">  105</span>                jfif_info-&gt;CompInfo[i].vfactor = buf[index + 1] &amp; 0x0F;</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno">  106</span>                jfif_info-&gt;CompInfo[i].qtab_id = buf[index + 2];</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno">  107</span> </div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span>                index += 3;</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>            }</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span> </div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a363b8424f26a6e3cf4799e1fbfbe9729">JFIF_MKR_DHT</a>: <span class="comment">/* 霍夫曼(Huffman)表 */</span></div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span>            blklen = (buf[index] &lt;&lt; 8) | buf[index + 1];</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span> </div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span>            index += 2;</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span>            blklen -= 2;</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno">  117</span>            <span class="keywordflow">while</span> (blklen)</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno">  118</span>            {</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno">  119</span>                uint8_t idx = buf[index] &amp; 0x0F;</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno">  120</span>                uint8_t typ = buf[index] &gt;&gt; 4; <span class="comment">/* 0 DC   1 AC */</span></div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno">  121</span> </div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span>                <span class="keywordflow">if</span> (idx &gt;= JFIF_HTAB_MAX)</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span>                    <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#ac50c00bd04463311543693c1b79f40ee">JFIF_NO_SUPPORT</a>;</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno">  124</span> </div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno">  125</span>                uint8_t indx = 0;</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno">  126</span>                uint16_t code = 0;</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span>                <span class="keywordflow">for</span> (i = 1; i &lt; 17; i++)</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span>                {</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno">  129</span>                    <span class="keywordflow">for</span> (j = 0; j &lt; buf[index + i]; j++)</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno">  130</span>                    {</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno">  131</span>                        <span class="keywordflow">if</span> (typ == 0)</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno">  132</span>                        {</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span>                            jfif_info-&gt;HTable[idx].DC.codeVal[indx] = buf[index + 17 + indx];</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span>                            jfif_info-&gt;HTable[idx].DC.codeLen[indx] = i;</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>                            jfif_info-&gt;HTable[idx].DC.codeWord[indx] = code;</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>                        }</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>                        <span class="keywordflow">else</span></div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span>                        {</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span>                            jfif_info-&gt;HTable[idx].AC.codeVal[indx] = buf[index + 17 + indx];</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span>                            jfif_info-&gt;HTable[idx].AC.codeLen[indx] = i;</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno">  141</span>                            jfif_info-&gt;HTable[idx].AC.codeWord[indx] = code;</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno">  142</span>                        }</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno">  143</span> </div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span>                        indx += 1;</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span>                        code += 1;</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span>                    }</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span> </div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span>                    code &lt;&lt;= 1;</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span>                }</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno">  150</span>                jfif_info-&gt;HTableCnt++;</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno">  151</span> </div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span>                index += 17 + indx;</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span>                blklen -= 17 + indx;</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno">  154</span>            }</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno">  155</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno">  156</span> </div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno">  157</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a36fd231faa24ffdb94906ef47045b6c2">JFIF_MKR_SOS</a>: <span class="comment">/* 扫描线开始 */</span></div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno">  158</span>            <span class="keywordflow">if</span> (buf[index + 2] != 3)</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno">  159</span>                <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#ac50c00bd04463311543693c1b79f40ee">JFIF_NO_SUPPORT</a>;</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno">  160</span> </div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno">  161</span>            index += 3;</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno">  162</span>            <span class="keywordflow">for</span> (i = 0; i &lt; jfif_info-&gt;CompCnt; i++)</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno">  163</span>            {</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno">  164</span>                jfif_info-&gt;CompInfo[i].htab_id_dc = buf[index + 1] &gt;&gt; 4;</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno">  165</span>                jfif_info-&gt;CompInfo[i].htab_id_ac = buf[index + 1] &amp; 0x0F;</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno">  166</span> </div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span>                index += 2;</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno">  168</span>            }</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno">  169</span> </div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno">  170</span>            <span class="keywordflow">if</span> (((buf[index] &lt;&lt; 16) | (buf[index + 1] &lt;&lt; 8) | buf[index + 2]) != 0x003F00)</div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span>                <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#a4d01127cf8b632845dd8745301a2855a">JFIF_FORMAT_ERR</a>;</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span>            index += 3;</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno">  173</span> </div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno">  174</span>            jfif_info-&gt;CodeAddr = (uint32_t)&amp;buf[index];</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno">  175</span>            jfif_info-&gt;CodeLen = len - index;</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno">  176</span> </div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno">  177</span>            <span class="keywordflow">if</span> (jfif_info-&gt;HTableCnt == 3)</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span>            {</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno">  179</span>                <span class="keywordflow">if</span> ((jfif_info-&gt;CompInfo[0].htab_id_dc == jfif_info-&gt;CompInfo[1].htab_id_dc) &amp;&amp;</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno">  180</span>                    (jfif_info-&gt;CompInfo[0].htab_id_dc == jfif_info-&gt;CompInfo[2].htab_id_dc)) <span class="comment">/* 共用DC表 */</span></div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno">  181</span>                {</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno">  182</span>                    <span class="keywordflow">if</span> (jfif_info-&gt;CompInfo[0].htab_id_dc == 0)</div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno">  183</span>                        memcpy(&amp;jfif_info-&gt;HTable[1].DC, &amp;jfif_info-&gt;HTable[0].DC, <span class="keyword">sizeof</span>(jfif_info-&gt;HTable[0].DC));</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno">  184</span>                    <span class="keywordflow">else</span></div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno">  185</span>                        memcpy(&amp;jfif_info-&gt;HTable[0].DC, &amp;jfif_info-&gt;HTable[1].DC, <span class="keyword">sizeof</span>(jfif_info-&gt;HTable[0].DC));</div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno">  186</span> </div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno">  187</span>                    jfif_info-&gt;CompInfo[0].htab_id_dc = jfif_info-&gt;CompInfo[0].htab_id_ac;</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno">  188</span>                    jfif_info-&gt;CompInfo[1].htab_id_dc = jfif_info-&gt;CompInfo[1].htab_id_ac;</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno">  189</span>                    jfif_info-&gt;CompInfo[2].htab_id_dc = jfif_info-&gt;CompInfo[2].htab_id_ac;</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno">  190</span>                }</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno">  191</span>                <span class="keywordflow">else</span> <span class="comment">/* 共用AC表 */</span></div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno">  192</span>                {</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno">  193</span>                    <span class="keywordflow">if</span> (jfif_info-&gt;CompInfo[0].htab_id_ac == 0)</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno">  194</span>                        memcpy(&amp;jfif_info-&gt;HTable[1].AC, &amp;jfif_info-&gt;HTable[0].AC, <span class="keyword">sizeof</span>(jfif_info-&gt;HTable[0].AC));</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno">  195</span>                    <span class="keywordflow">else</span></div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno">  196</span>                        memcpy(&amp;jfif_info-&gt;HTable[0].AC, &amp;jfif_info-&gt;HTable[1].AC, <span class="keyword">sizeof</span>(jfif_info-&gt;HTable[0].AC));</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno">  197</span> </div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno">  198</span>                    jfif_info-&gt;CompInfo[0].htab_id_ac = jfif_info-&gt;CompInfo[0].htab_id_dc;</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno">  199</span>                    jfif_info-&gt;CompInfo[1].htab_id_ac = jfif_info-&gt;CompInfo[1].htab_id_dc;</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno">  200</span>                    jfif_info-&gt;CompInfo[2].htab_id_ac = jfif_info-&gt;CompInfo[2].htab_id_dc;</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno">  201</span>                }</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno">  202</span> </div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno">  203</span>                jfif_info-&gt;HTableCnt += 1;</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno">  204</span>            }</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno">  205</span> </div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno">  206</span>            jfif_info-&gt;HTableCnt /= 2;</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno">  207</span> </div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno">  208</span>            <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#a23863c3287532ed3417695b1568ccb64">JFIF_RES_OK</a>;</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno">  209</span> </div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno">  210</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a823d2744fc90e770ad6a37e458fd5364">JFIF_MKR_DRI</a>: <span class="comment">/* 重新开始间隔DRI(Difine Restart Interval),不存在，或为0 */</span></div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno">  211</span>        <span class="keywordflow">case</span> <a class="code hl_define" href="jfif__parser_8h.html#a92420a32df6cfd74c23f633856ef0770">JFIF_MKR_COM</a>:</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno">  212</span>            index += (buf[index] &lt;&lt; 8) | buf[index + 1];</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno">  213</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno">  214</span> </div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno">  215</span>        <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno">  216</span>            <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#a4d01127cf8b632845dd8745301a2855a">JFIF_FORMAT_ERR</a>;</div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno">  217</span>        }</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno">  218</span>    } <span class="keywordflow">while</span> (index &lt; len);</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno">  219</span> </div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno">  220</span>    <span class="keywordflow">return</span> <a class="code hl_define" href="jfif__parser_8h.html#a4d01127cf8b632845dd8745301a2855a">JFIF_FORMAT_ERR</a>;</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno">  221</span>}</div>
<div class="ttc" id="ajfif__parser_8c_html_abf9f65ef7651d67c735920acc808427a"><div class="ttname"><a href="jfif__parser_8c.html#abf9f65ef7651d67c735920acc808427a">jfif_parse</a></div><div class="ttdeci">int jfif_parse(const uint8_t buf[], uint32_t len, jfif_info_t *jfif_info)</div><div class="ttdoc">JPEG 图片解析 JFIF 格式</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8c_source.html#l00037">jfif_parser.c:37</a></div></div>
<div class="ttc" id="ajfif__parser_8c_html_ad5869f8e3b141200c34cb4541329a8b2"><div class="ttname"><a href="jfif__parser_8c.html#ad5869f8e3b141200c34cb4541329a8b2">JFIF_Info</a></div><div class="ttdeci">jfif_info_t JFIF_Info</div><div class="ttdoc">JFIF 格式解析信息</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8c_source.html#l00025">jfif_parser.c:25</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html"><div class="ttname"><a href="jfif__parser_8h.html">jfif_parser.h</a></div><div class="ttdoc">jpeg 图片 jfif 格式解析</div></div>
<div class="ttc" id="ajfif__parser_8h_html_a172b132fe97aa2942518e04729cfcb86"><div class="ttname"><a href="jfif__parser_8h.html#a172b132fe97aa2942518e04729cfcb86">JFIF_MKR_APP0</a></div><div class="ttdeci">#define JFIF_MKR_APP0</div><div class="ttdoc">Application 0</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00037">jfif_parser.h:37</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a1e00683a66e9cd95bdf96c5ce017642f"><div class="ttname"><a href="jfif__parser_8h.html#a1e00683a66e9cd95bdf96c5ce017642f">JFIF_MKR_APP8</a></div><div class="ttdeci">#define JFIF_MKR_APP8</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00045">jfif_parser.h:45</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a23863c3287532ed3417695b1568ccb64"><div class="ttname"><a href="jfif__parser_8h.html#a23863c3287532ed3417695b1568ccb64">JFIF_RES_OK</a></div><div class="ttdeci">#define JFIF_RES_OK</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00026">jfif_parser.h:26</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a363b8424f26a6e3cf4799e1fbfbe9729"><div class="ttname"><a href="jfif__parser_8h.html#a363b8424f26a6e3cf4799e1fbfbe9729">JFIF_MKR_DHT</a></div><div class="ttdeci">#define JFIF_MKR_DHT</div><div class="ttdoc">Define Huffman Table</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00031">jfif_parser.h:31</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a36fd231faa24ffdb94906ef47045b6c2"><div class="ttname"><a href="jfif__parser_8h.html#a36fd231faa24ffdb94906ef47045b6c2">JFIF_MKR_SOS</a></div><div class="ttdeci">#define JFIF_MKR_SOS</div><div class="ttdoc">Start Of Scan</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00034">jfif_parser.h:34</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a4d01127cf8b632845dd8745301a2855a"><div class="ttname"><a href="jfif__parser_8h.html#a4d01127cf8b632845dd8745301a2855a">JFIF_FORMAT_ERR</a></div><div class="ttdeci">#define JFIF_FORMAT_ERR</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00027">jfif_parser.h:27</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a556cc4919d609155d762078774ce2f9d"><div class="ttname"><a href="jfif__parser_8h.html#a556cc4919d609155d762078774ce2f9d">JFIF_MKR_APP4</a></div><div class="ttdeci">#define JFIF_MKR_APP4</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00041">jfif_parser.h:41</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a6861f9aab4c23e24e8a961aed25494c3"><div class="ttname"><a href="jfif__parser_8h.html#a6861f9aab4c23e24e8a961aed25494c3">JFIF_MKR_APPa</a></div><div class="ttdeci">#define JFIF_MKR_APPa</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00047">jfif_parser.h:47</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a6e341919d001f46a6596443f30aeffed"><div class="ttname"><a href="jfif__parser_8h.html#a6e341919d001f46a6596443f30aeffed">JFIF_MKR_APPc</a></div><div class="ttdeci">#define JFIF_MKR_APPc</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00049">jfif_parser.h:49</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a6fc9691d02dac880729c77500ca74840"><div class="ttname"><a href="jfif__parser_8h.html#a6fc9691d02dac880729c77500ca74840">JFIF_MKR_APP5</a></div><div class="ttdeci">#define JFIF_MKR_APP5</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00042">jfif_parser.h:42</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a7aa18bbaba75cbce2043f7c491fc1ea3"><div class="ttname"><a href="jfif__parser_8h.html#a7aa18bbaba75cbce2043f7c491fc1ea3">JFIF_MKR_APP3</a></div><div class="ttdeci">#define JFIF_MKR_APP3</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00040">jfif_parser.h:40</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a7f59810f48f8ef149eb486375f55c494"><div class="ttname"><a href="jfif__parser_8h.html#a7f59810f48f8ef149eb486375f55c494">JFIF_MKR_APP1</a></div><div class="ttdeci">#define JFIF_MKR_APP1</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00038">jfif_parser.h:38</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a823d2744fc90e770ad6a37e458fd5364"><div class="ttname"><a href="jfif__parser_8h.html#a823d2744fc90e770ad6a37e458fd5364">JFIF_MKR_DRI</a></div><div class="ttdeci">#define JFIF_MKR_DRI</div><div class="ttdoc">Define restart interval</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00036">jfif_parser.h:36</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a92420a32df6cfd74c23f633856ef0770"><div class="ttname"><a href="jfif__parser_8h.html#a92420a32df6cfd74c23f633856ef0770">JFIF_MKR_COM</a></div><div class="ttdeci">#define JFIF_MKR_COM</div><div class="ttdoc">Comment</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00053">jfif_parser.h:53</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a98623911284c193c0118fee1ddb2f993"><div class="ttname"><a href="jfif__parser_8h.html#a98623911284c193c0118fee1ddb2f993">JFIF_MKR_APP7</a></div><div class="ttdeci">#define JFIF_MKR_APP7</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00044">jfif_parser.h:44</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_a98cc24ac5256f960b8450aa4adca78b9"><div class="ttname"><a href="jfif__parser_8h.html#a98cc24ac5256f960b8450aa4adca78b9">JFIF_MKR_APP6</a></div><div class="ttdeci">#define JFIF_MKR_APP6</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00043">jfif_parser.h:43</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_aa3aca71aaed62e13cdd3a0a3b7fef752"><div class="ttname"><a href="jfif__parser_8h.html#aa3aca71aaed62e13cdd3a0a3b7fef752">JFIF_MKR_DQT</a></div><div class="ttdeci">#define JFIF_MKR_DQT</div><div class="ttdoc">Define Quantization Table</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00035">jfif_parser.h:35</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_aa9138cde6f4eec984591fa8c349ff00a"><div class="ttname"><a href="jfif__parser_8h.html#aa9138cde6f4eec984591fa8c349ff00a">JFIF_MKR_APPb</a></div><div class="ttdeci">#define JFIF_MKR_APPb</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00048">jfif_parser.h:48</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_ab902af7fd9759bbaa04a30b84d1e8712"><div class="ttname"><a href="jfif__parser_8h.html#ab902af7fd9759bbaa04a30b84d1e8712">JFIF_MKR_APPe</a></div><div class="ttdeci">#define JFIF_MKR_APPe</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00051">jfif_parser.h:51</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_abc075d5ba82599e6162dee5140312ebb"><div class="ttname"><a href="jfif__parser_8h.html#abc075d5ba82599e6162dee5140312ebb">JFIF_MKR_SOI</a></div><div class="ttdeci">#define JFIF_MKR_SOI</div><div class="ttdoc">Start Of Image</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00032">jfif_parser.h:32</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_abdc9b4d26d096c86838f459df7fcc346"><div class="ttname"><a href="jfif__parser_8h.html#abdc9b4d26d096c86838f459df7fcc346">JFIF_MKR_APP2</a></div><div class="ttdeci">#define JFIF_MKR_APP2</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00039">jfif_parser.h:39</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_ac50c00bd04463311543693c1b79f40ee"><div class="ttname"><a href="jfif__parser_8h.html#ac50c00bd04463311543693c1b79f40ee">JFIF_NO_SUPPORT</a></div><div class="ttdeci">#define JFIF_NO_SUPPORT</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00028">jfif_parser.h:28</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_ad062996de504f692a05352122cf7971c"><div class="ttname"><a href="jfif__parser_8h.html#ad062996de504f692a05352122cf7971c">JFIF_MKR_APP9</a></div><div class="ttdeci">#define JFIF_MKR_APP9</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00046">jfif_parser.h:46</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_adeb5763efbd0957a8bd88656961a27eb"><div class="ttname"><a href="jfif__parser_8h.html#adeb5763efbd0957a8bd88656961a27eb">JFIF_MKR_SOF0</a></div><div class="ttdeci">#define JFIF_MKR_SOF0</div><div class="ttdoc">Start Of Frame (SOF0 for baseline DCT)</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00030">jfif_parser.h:30</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_ae8610e4d1a9cd877e75be61940546d79"><div class="ttname"><a href="jfif__parser_8h.html#ae8610e4d1a9cd877e75be61940546d79">JFIF_MKR_APPf</a></div><div class="ttdeci">#define JFIF_MKR_APPf</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00052">jfif_parser.h:52</a></div></div>
<div class="ttc" id="ajfif__parser_8h_html_ae88e60f25611f85e5e747b7bffd74663"><div class="ttname"><a href="jfif__parser_8h.html#ae88e60f25611f85e5e747b7bffd74663">JFIF_MKR_APPd</a></div><div class="ttdeci">#define JFIF_MKR_APPd</div><div class="ttdef"><b>Definition:</b> <a href="jfif__parser_8h_source.html#l00050">jfif_parser.h:50</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
